# 编译镜像
FROM golang:1.16-alpine AS build

WORKDIR /project/
COPY ./project /project
RUN go env -w GOPROXY=https://goproxy.io,direct
RUN go build -o /project/work/server main.go

# 运行镜像
FROM alpine
ENV TZ Asia/Shanghai
COPY --from=build /project/work/ /work/

# 定义工作目录为work
WORKDIR /work
# 开放http 80端口
EXPOSE 80
# 启动http服务
ENTRYPOINT ["./server"]
